<template>
  <div class="wrapper">
    <div class="login-box">
      <h3>登录页面</h3>
      <div>提示：随便输入都能登录</div>
      <p>
        <input v-model="userInfo.username" class="input-first" />
      </p>
      <p>
        <input v-model="userInfo.password" class="input-first" type="password" />
      </p>
      <p>
        <button class="btn-first" @click="toLogin">登录</button>
      </p>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      userInfo:{
        username: '',
        password: ''
      }
    }
  },
  methods:{
    toLogin(){
      if(this.userInfo.username && this.userInfo.password ){
        // sessionStorage.setItem('username',this.userInfo.username)
        this.$router.push(`/?userId=${this.userInfo.username}`)
      } else {
        alert('请输入账号和密码登录')
      }
    }
  }
}
</script>

<style>
  .wrapper{
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .login-box{
    padding: 25px;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 5px;
  }
  .input-first,.btn-first{
    height: 40px;
    line-height: 40px;
    border-radius: 3px;
    border: 1px solid #ddd;
    padding: 0 10px;
  }
  .btn-first{
    background-color: #69f;
    color: #fff;
    padding: 0 20px;
  }

</style>